<?php
namespace web\home\controller;
class Content extends Common{
    //动作
	public function index(){
		//请求地址栏的aid
		$aid=q('get.aid',0,'intval');
		Db::table('article')->where('aid',$aid)
			//点击文章次数+1
			->increment('click',1);
		$articleData = Db::table('article')
			//文章表文章数据表关联
			->join('article_data','aid','=','article_aid')
			//通过aid 找到一条
			->where('aid',$aid)->first();
		$articleData['tag'] = Db::table('article_tag')
			//中间表和标签表关联
			->join('tag','tag_tid','=','tid')
			->where('article_aid',$aid)
			->field(['tid','tname'])
			->get();
		View::with('articleData',$articleData);
//		p($articleData);
		//title 标签数据
		$conf = ['title'=>$articleData['title']];
		View::with('conf',$conf);
		View::make();
	}
}
